<!DOCTYPE html>

<html lang="en">

<head>
    <meta name="layout" content="main2" />
    <g:set var="entityName" value="${message(code: 'contact.label', default: 'contact')}" />
    <title>联系人编辑</title>
</head>

<body>
    <div class="main-body">
        <div class="page-wrapper">
            <!-- Page-header start -->
            <div class="page-header">
                <div class="page-header-title">
                    <h4></h4>
                </div>

                <div class="page-header-breadcrumb">
                    <ul class="breadcrumb-title">
                        <li class="breadcrumb-item">
                            <a href="/salesDashboard/index">
                                <i class="icofont icofont-home"></i>
                            </a>
                        </li>
                        <li class="breadcrumb-item">
                            <g:link controller="contact" action="index">联系人列表</g:link>
                        </li>
                        <li class="breadcrumb-item">编辑联系人</li>
                    </ul>
                </div>
            </div>

            <div class="page-body">
                <g:if test="${flash.message}">
                    <div class="message alert alert-info" role="status">${flash.message}
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
                    </div>
                </g:if>
                <g:hasErrors bean="${this.contact}">
                    <ul class="errors" role="alert">
                        <g:eachError bean="${this.contact}" var="error">
                            <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>>
                                <g:message error="${error}" />
                            </li>
                        </g:eachError>
                    </ul>
                </g:hasErrors>
                <g:form resource="${this.contact}" action="update" class="form-horizontal">
                    <g:textField class="hidden" name="targetUri" value="${targetUri}"></g:textField>
                    <div class="card">
                        <div class="card-header">
                            <h5>编辑联系人</h5>

                            <div class="card-header-right">
                                <i class="icofont icofont-rounded-down"></i>
                            </div>
                        </div>
                        <div class="card-block">

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label is-required">姓名</label>

                                <div class="col-md-3">
                                    <input class="form-control" name="fullName" type="text" value="${this.contact?.fullName}">
                                </div>
                                <label class="col-md-2 col-form-label">所有者</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="user" value="${this.contact?.user?.id}" id="level" optionKey="id" optionValue="fullName" from="${com.next.User.list()}" noSelection="${['': '请选择']}" />
                                </div>

                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label">称谓</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="salutation.id" value="${this.contact?.salutation?.id}" from="${com.next.Salutation.list()}" optionKey="id" optionValue="name" noSelection="${['': '请选择']}"></g:select>

                                </div>
                                <label class="col-md-2 col-form-label">头衔</label>

                                <div class="col-md-3">
                                    <g:textField class="form-control" name="title" value="${this.contact?.title}" />
                                </div>
                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label">职务</label>

                                <div class="col-md-3">
                                    <g:textField class="form-control" name="job" value="${this.contact?.job}" />
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label">邮箱</label>

                                <div class="col-md-3">

                                    <input class="form-control" name="email" type="email" value="${this.contact?.email}">

                                </div>
                                <label class="col-md-2 col-form-label">传真</label>

                                <div class="col-md-3">

                                    <input class="form-control" name="fax" type="text" value="${this.contact?.fax}">

                                </div>

                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label is-required">电话</label>

                                <div class="col-md-3">
                                    <input class="form-control" name="phone" type="text" value="${this.contact?.phone}">
                                </div>
                                <label class="col-md-2 col-form-label">手机</label>

                                <div class="col-md-3">
                                    <input class="form-control" name="cellphone" type="text" MaxLength="11" value="${this.contact?.cellphone}">
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label">微信</label>

                                <div class="col-md-3">
                                    <g:textField class="form-control" name="wechat" value="${this.contact?.wechat}" />

                                </div>
                                <label class="col-md-2 col-form-label">QQ</label>

                                <div class="col-md-3">
                                    <g:textField class="form-control" name="qq" value="${this.contact?.qq}" />
                                </div>

                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label">生日</label>
                                <div class="col-md-3 datePicker">
                                    %{-- <g:datePicker name="birthday" value="${this.contact?.birthday}" precision="minute" /> --}%
                                    <div class="input-group">
                                        <input type="text" valctrl="birthday" value="${this.contact?.birthday}" class="form-control form_date">
                                        <input type="hidden" id="birthday" name="birthday" value="date.struct">
                                        <input type="hidden" id="birthday_day" name="birthday_day" value="">
                                        <input type="hidden" id="birthday_month" name="birthday_month" value="">
                                        <input type="hidden" id="birthday_year" name="birthday_year" value="">
                                    </div>
                                </div>

                                <label class="col-md-2 col-form-label">家乡</label>
                                <div class="col-md-3">
                                    <g:textField class="form-control" name="hometown" value="${this.contact?.hometown}" />
                                </div>

                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label">爱好</label>

                                <div class="col-md-3">
                                    <g:textField class="form-control" name="hobby" value="${this.contact?.hobby}" />
                                </div>
                                <label class="col-md-2 col-form-label">禁忌</label>

                                <div class="col-md-3">
                                    <g:textField class="form-control" name="taboo" value="${this.contact?.taboo}" />
                                </div>

                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label">国家</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="country.id" value="${this.contact?.country?.id}" from="${com.next.Country.list()}" optionKey="id" optionValue="name" noSelection="${['': '请选择']}"></g:select>
                                </div>
                                <label class="col-md-2 col-form-label">城市</label>

                                <div class="col-md-3">
                                    <g:select class="form-control m-b" name="city" id="city" optionValue="name" optionKey="id" noSelection="${['': '请选择']}" from="${com.next.City.list()}" value="${this.contact?.city?.id}" />
                                </div>
                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label">身份证号</label>

                                <div class="col-md-3">

                                    <input class="form-control" name="idNumber" type="text" value="${this.contact?.idNumber}">

                                </div>

                                <label class="col-md-2 col-form-label">婚姻状况</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="maritalStatus" noSelection="${['': '请选择']}" value="${this.contact?.maritalStatus}" from="${this.contact.constrainedProperties.maritalStatus.inList}" />
                                </div>

                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label">性别</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="gender" noSelection="${['': '请选择']}" value="${this.contact?.gender}" from="${this.contact.constrainedProperties.gender.inList}" />
                                </div>

                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label">联系人来源</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="source.id" value="${this.contact?.source?.id}" from="${com.next.LeadSource.list()}" optionKey="id" optionValue="name" noSelection="${['': '请选择']}"></g:select>
                                </div>
                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label">手机已验证</label>

                                <div class="col-md-3 border-checkbox-section">
                                    <div class="border-checkbox-group border-checkbox-group-primary form-control-static">
                                        <g:checkBox class="border-checkbox" name="cellphoneHasVerified" id="checkbox0" value="${this.contact?.cellphoneHasVerified}" />
                                        <label class="border-checkbox-label" for="checkbox0"></label>
                                    </div>

                                </div>

                                <label class="col-md-2 col-form-label">是否激活</label>

                                <div class="col-md-3 border-checkbox-section">
                                    <div class="border-checkbox-group border-checkbox-group-primary form-control-static">
                                        <g:checkBox class="border-checkbox" name="active" id="checkbox1" value="${this.contact?.active}" />
                                        <label class="border-checkbox-label" for="checkbox1"></label>
                                    </div>

                                </div>

                            </div>
                        </div>

                    </div>

                    <div class="card">
                        <div class="card-header">
                            <h5>其他信息</h5>

                            <div class="card-header-right">
                                <i class="icofont icofont-rounded-down"></i>
                            </div>
                        </div>
                        <div class="card-block">
                            <div class="form-group row">

                                <label class="col-md-2 col-form-label is-required">客户</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="account.id" value="${this.contact?.account?.id}" from="${com.next.Account.findAllByActive(true)}" optionKey="id" optionValue="name" noSelection="${['': '请选择']}"></g:select>
                                </div>
                                <label class="col-md-2 col-form-label">线索</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="lead.id" value="${this.contact?.lead?.id}" from="${com.next.Lead.list()}" optionKey="id" optionValue="fullName" noSelection="${['': '请选择']}"></g:select>
                                </div>

                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label is-required">联系人类型</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="type.id" value="${this.contact?.type?.id}" from="${com.next.ContactType.list()}" optionKey="id" optionValue="name" noSelection="${['': '请选择']}"></g:select>
                                </div>
                                <label class="col-md-2 col-form-label">联系人分级</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="level.id" value="${this.contact?.level?.id}" from="${com.next.ContactLevel.list()}" optionKey="id" optionValue="name" noSelection="${['': '请选择']}"></g:select>
                                </div>

                            </div>

                            <g:if test="${this.enableTerritory}">
                                <div class="form-group row">

                                    <label class="col-md-2 col-form-label">销售区域</label>

                                    <div class="col-md-3">
                                        <g:select class="form-control" name="territory" value="${this.contact?.territory?.id}" id="level" optionKey="id" optionValue="name" from="${com.next.Territory.findAllByActive(true)}" noSelection="${['': '请选择']}" />
                                    </div>

                                </div>

                            </g:if>
                            <div class="form-group row">
                                <label class="col-md-2 col-form-label">入职时间</label>

                                <div class="col-md-3 datePicker">
                                    %{-- <g:datePicker name="hireDate" value="${this.contact?.hireDate}" precision="day" default="none" noSelection="['': '请选择']" /> --}%
                                    <div class="input-group">
                                        <input type="text" valctrl="hireDate" value="${this.contact?.hireDate}" class="form-control form_date">
                                        <input type="hidden" id="hireDate" name="hireDate" value="date.struct">
                                        <input type="hidden" id="hireDate_day" name="hireDate_day" value="">
                                        <input type="hidden" id="hireDate_month" name="hireDate_month" value="">
                                        <input type="hidden" id="hireDate_year" name="hireDate_year" value="">
                                    </div>
                                </div>
%{--                                 <label class="col-md-2 col-form-label">离职时间</label>

                                <div class="col-md-3 datePicker">
                                    <g:datePicker name="leaveDate" value="${this.contact?.leaveDate}" precision="day" default="none" noSelection="['': '请选择']" />
                                </div>
 --}%
                            </div>

                            <div class="form-group row">
                                <div class="col-md-6">
                                    <!-- <g:submitButton name="create" class="btn btn-info" value="保存" /> -->
                                    <g:submitButton class="btn btn-info" name="update" value="保存" />
                                </div>
                            </div>

                        </div>

                    </div>
                </g:form>
            </div>

        </div>
    </div>
</body>

</html>
